<!--TABLE html5_blog__users
    (
        ID bigint NOT NULL AUTO_INCREMENT,
        user_login VARCHAR(60) NOT NULL,
        user_pass VARCHAR(64) NOT NULL,
        user_nicename VARCHAR(50) NOT NULL,
        user_email VARCHAR(100) NOT NULL,
        user_url VARCHAR(100) NOT NULL,
        user_registered DATETIME DEFAULT '0000-00-00 00:00:00' NOT NULL,
        user_activation_key VARCHAR(60) NOT NULL,
        user_status INT DEFAULT '0' NOT NULL,
        display_name VARCHAR(250) NOT NULL,
        PRIMARY KEY (ID),
        INDEX user_login_key (user_login),
        INDEX user_nicename (user_nicename)
    )-->

<?php
class User_model extends CI_Model {
	
	private $html5_blog__users= 'html5_blog__users';
	
	function __construct(){
		parent::__construct();
	}
	
	function list_all(){
		$this->db->order_by('id','asc');
		return $this->db->get($html5_blog__users);
	}
	
	function count_all(){
		return $this->db->count_all($this->html5_blog__users);
	}
	
	function get_paged_list($limit = 10, $offset = 0){
		$this->db->order_by('id','asc');
		return $this->db->get($this->html5_blog__users, $limit, $offset);
	}
	
	function get_by_id($id){
		$this->db->where('id', $id);
		return $this->db->get($this->html5_blog__users);
	}
	
	function save($person){
		$this->db->insert($this->html5_blog__users, $person);
		return $this->db->insert_id();
	}
	
	function update($id, $person){
		$this->db->where('id', $id);
		$this->db->update($this->html5_blog__users, $person);
	}
	
	function delete($id){
		$this->db->where('id', $id);
		$this->db->delete($this->html5_blog__users);
	}
}
?>
